export default {
    saveLoginInfo(state, data) {
        state.user.token = data.Token
        state.user.ticket = data.Ticket
        state.user.userId = data.userId
        state.user.safetyfactor = data.safetyfactor
        state.user.userName = data.userName
        state.user.userRegDate = data.userRegDate
        state.user.userHeadImg = data.userHeadImg
    },
    clearLoginInfo(state) {
        state.user.token = ''
        state.user.ticket = ''
        state.user.userId = ''
        state.user.safetyfactor = ''
        state.user.userName = ''
        state.user.userRegDate = ''
        state.user.userHeadImg = ''
    },
    getWechatSdk(state) {
        state.wechact.isGetWechatSdk = 1
    },
    // 设置获取微信SDK状态
    setGetWechatSdkStu(state, stutas = 'ing') {
        if (state.wechat && state.wechat.getGetWechatSdkStu) {
            state.wechat.getGetWechatSdkStu = stutas
        }
        // console.log('state.wechact', state.wechact)
    },
    // 设置某事成功后的数据
    success(state, data) {
        state.success.page = data.page
        state.success.type = data.type
        state.success.data = data.data
    },
    // 设置产品列表
    setProductList(state, data = []) {
        const arr = []
        data.forEach(item => {
            // console.log('item', item)
            arr.push({
                code: item.Code,
                name: item.GoodsName,
                series: item.Series,
            })
        })
        state.productList = arr
    },
    // 设置更新弹窗时间
    setUpDataTime(state, time) {
        if (time) {
            state.showUpDataTime = time
        }
    },
}